home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / vbasic / datamgr.exe / DATAFORM.FRM next >
Text File  |  1993-04-21  |  19KB  |  729 lines

  1. VERSION 2.00
  2. Begin Form DataForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    ClientHeight    =   3960
  5.    ClientLeft      =   630
  6.    ClientTop       =   1755
  7.    ClientWidth     =   8475
  8.    Height          =   4365
  9.    Icon            =   DATAFORM.FRX:0000
  10.    Left            =   570
  11.    LinkTopic       =   "Form2"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   3960
  14.    ScaleWidth      =   8475
  15.    Top             =   1410
  16.    Width           =   8595
  17.    Begin PictureBox StatBox 
  18.       Align           =   2  'Align Bottom
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   270
  22.       Left            =   0
  23.       ScaleHeight     =   282.462
  24.       ScaleMode       =   0  'User
  25.       ScaleWidth      =   8490.27
  26.       TabIndex        =   5
  27.       Top             =   3690
  28.       Width           =   8475
  29.       Begin Data Data1 
  30.          Connect         =   ""
  31.          DatabaseName    =   ""
  32.          Exclusive       =   0   'False
  33.          Height          =   270
  34.          Left            =   0
  35.          Options         =   0
  36.          ReadOnly        =   0   'False
  37.          RecordSource    =   ""
  38.          Top             =   0
  39.          Width           =   5475
  40.       End
  41.    End
  42.    Begin VScrollBar cScrollBar 
  43.       Height          =   2085
  44.       LargeChange     =   3500
  45.       Left            =   7665
  46.       SmallChange     =   350
  47.       TabIndex        =   14
  48.       Top             =   630
  49.       Visible         =   0   'False
  50.       Width           =   255
  51.    End
  52.    Begin PictureBox cFields 
  53.       BackColor       =   &H00C0C0C0&
  54.       BorderStyle     =   0  'None
  55.       Height          =   1065
  56.       Left            =   0
  57.       ScaleHeight     =   1056.48
  58.       ScaleMode       =   0  'User
  59.       ScaleWidth      =   7600.262
  60.       TabIndex        =   9
  61.       TabStop         =   0   'False
  62.       Top             =   630
  63.       Width           =   7605
  64.       Begin TextBox cFieldData 
  65.          BackColor       =   &H00FFFFFF&
  66.          DataSource      =   "Data1"
  67.          ForeColor       =   &H00000000&
  68.          Height          =   285
  69.          Index           =   0
  70.          Left            =   1679
  71.          TabIndex        =   12
  72.          Top             =   0
  73.          Visible         =   0   'False
  74.          Width           =   3255
  75.       End
  76.       Begin CheckBox cFieldCheck 
  77.          BackColor       =   &H00C0C0C0&
  78.          DataSource      =   "Data1"
  79.          Height          =   330
  80.          Index           =   0
  81.          Left            =   1679
  82.          TabIndex        =   11
  83.          Top             =   735
  84.          Visible         =   0   'False
  85.          Width           =   3270
  86.       End
  87.       Begin PictureBox cFieldPicture 
  88.          DataSource      =   "Data1"
  89.          Height          =   282
  90.          Index           =   0
  91.          Left            =   1679
  92.          ScaleHeight     =   255
  93.          ScaleWidth      =   3240
  94.          TabIndex        =   10
  95.          Top             =   315
  96.          Visible         =   0   'False
  97.          Width           =   3270
  98.       End
  99.       Begin Label cFieldName 
  100.          BackColor       =   &H00C0C0C0&
  101.          ForeColor       =   &H00000000&
  102.          Height          =   225
  103.          Index           =   0
  104.          Left            =   105
  105.          TabIndex        =   13
  106.          Top             =   0
  107.          Visible         =   0   'False
  108.          Width           =   1515
  109.       End
  110.    End
  111.    Begin PictureBox FieldHeader 
  112.       Align           =   1  'Align Top
  113.       BackColor       =   &H00C0C0C0&
  114.       BorderStyle     =   0  'None
  115.       Height          =   300
  116.       Left            =   0
  117.       ScaleHeight     =   300
  118.       ScaleMode       =   0  'User
  119.       ScaleWidth      =   8480.059
  120.       TabIndex        =   6
  121.       Top             =   330
  122.       Width           =   8475
  123.       Begin Label FieldValueLabel 
  124.          BackColor       =   &H00C0C0C0&
  125.          Caption         =   " Value:"
  126.          Height          =   252
  127.          Left            =   1680
  128.          TabIndex        =   8
  129.          Top             =   30
  130.          Width           =   2652
  131.       End
  132.       Begin Label FieldHdrLabel 
  133.          BackColor       =   &H00C0C0C0&
  134.          Caption         =   "Field Name:"
  135.          Height          =   252
  136.          Left            =   120
  137.          TabIndex        =   7
  138.          Top             =   30
  139.          Width           =   1212
  140.       End
  141.    End
  142.    Begin PictureBox TopPic 
  143.       Align           =   1  'Align Top
  144.       BackColor       =   &H00C0C0C0&
  145.       BorderStyle     =   0  'None
  146.       Height          =   330
  147.       Left            =   0
  148.       ScaleHeight     =   330
  149.       ScaleWidth      =   8475
  150.       TabIndex        =   0
  151.       Top             =   0
  152.       Width           =   8475
  153.       Begin CommandButton RefreshBtn 
  154.          Caption         =   "&Refresh"
  155.          Height          =   260
  156.          Left            =   4680
  157.          TabIndex        =   15
  158.          Top             =   0
  159.          Width           =   1215
  160.       End
  161.       Begin CommandButton FindBtn 
  162.          Caption         =   "&Find"
  163.          Height          =   260
  164.          Left            =   3480
  165.          TabIndex        =   4
  166.          Top             =   0
  167.          Width           =   1215
  168.       End
  169.       Begin CommandButton DeleteBtn 
  170.          Caption         =   "&Delete"
  171.          Height          =   260
  172.          Left            =   2280
  173.          TabIndex        =   3
  174.          Top             =   0
  175.          Width           =   1215
  176.       End
  177.       Begin CommandButton AddBtn 
  178.          Caption         =   "&Add"
  179.          Height          =   260
  180.          Left            =   0
  181.          TabIndex        =   2
  182.          Top             =   0
  183.          Width           =   1215
  184.       End
  185.       Begin CommandButton UpdateBtn 
  186.          Caption         =   "&Update"
  187.          Height          =   260
  188.          Left            =   1200
  189.          TabIndex        =   1
  190.          Top             =   0
  191.          Width           =   1095
  192.       End
  193.    End
  194. End
  195. Dim FldArr() As control
  196.  
  197. Dim FDS As Dynaset
  198. Dim numFlds As Integer
  199. Dim CurrField As Integer
  200. Dim JustUsedFind As Integer        'flag for find function
  201. Dim fResizing As Integer           'flag to avoid resize recursion
  202.  
  203. Dim FldTop As Integer
  204.  
  205. Const EM_NOTHING = 0
  206. Const EM_EDIT = 1
  207. Const EM_ADDNEW = 2
  208.  
  209. Const FT_TRUEFALSE = 1
  210. Const FT_BYTE = 2
  211. Const FT_INTEGER = 3
  212. Const FT_LONG = 4
  213. Const FT_CURRENCY = 5
  214. Const FT_SINGLE = 6
  215. Const FT_DOUBLE = 7
  216. Const FT_DATETIME = 8
  217. Const FT_STRING = 10
  218. Const FT_BINARY = 11
  219. Const FT_MEMO = 12
  220.  
  221. Const YES = 6
  222. Const MSGBOX_TYPE = 4 + 48
  223.  
  224. Sub AddBtn_Click ()
  225.   On Error GoTo AddErr
  226.     
  227.     data1.Caption = "Entering New Record"
  228.   If AddBtn.Tag = "Disabled" Then
  229.     EnableAllControls
  230.   End If
  231.   data1.Recordset.AddNew
  232.   FldArr(0).SetFocus
  233.   Exit Sub
  234.  
  235. AddErr:
  236.   MsgBox Error$
  237.   Resume AddEnd
  238. AddEnd:
  239.  
  240. End Sub
  241.  
  242. Sub cFieldPicture_Click (Index As Integer)
  243.   'this toggles the size of a picture control
  244.   'so it mat be viewed or compressed
  245.   If cFieldPicture(Index).Height <= 280 Then
  246.     cFieldPicture(Index).AutoSize = True
  247.   Else
  248.     cFieldPicture(Index).AutoSize = False
  249.     cFieldPicture(Index).Height = 280
  250.   End If
  251. End Sub
  252.  
  253. Sub cFieldPicture_DblClick (Index As Integer)
  254.   On Error GoTo PicErr
  255.  
  256.   st = InputBox("Enter Picture FilName:")
  257.   If st <> "" Then
  258.     cFieldPicture(Index).Picture = LoadPicture(st)
  259.   End If
  260.  
  261.   GoTo PicEnd
  262.  
  263. PicErr:
  264.   MsgBox Error$
  265.   Resume PicEnd
  266.  
  267. PicEnd:
  268.  
  269. End Sub
  270.  
  271. Sub cScrollBar_Change ()
  272.   Dim t As Integer
  273.  
  274.   t = cScrollBar
  275.   If (t - FldTop) Mod 350 = 0 Then
  276.     cFields.Top = t
  277.   Else
  278.     cFields.Top = ((t - FldTop) \ 350) * 350 + FldTop
  279.   End If
  280.  
  281. End Sub
  282.  
  283. Sub Data1_Error (dataerr As Integer, response As Integer)
  284.   If dataerr = 3021 Then
  285.     response = 0
  286.   ElseIf dataerr = 481 Or dataerr = 321 Then 'Invalid picture
  287.     response = 0
  288.   Else
  289.     MsgBox "Error:  " + Error$(dataerr)
  290.     response = 0
  291.   End If
  292. End Sub
  293.  
  294. Sub data1_Reposition ()
  295.     'if not valid record and not in addnew mode
  296.     If (data1.Recordset.BOF Or data1.Recordset.EOF) And data1.Caption <> "Entering New Record" Then
  297.         DisableAllControls
  298.     'otherwise, if form is disabled, then enable it
  299.     ElseIf AddBtn.Tag = "Disabled" Then
  300.         EnableAllControls
  301.     Else
  302.        If data1.Caption <> "Entering New Record" Then data1.Caption = "Editing Record"
  303.     End If
  304. End Sub
  305.  
  306. Sub Data1_Validate (Action As Integer, save As Integer)
  307. On Error Resume Next
  308.   'first check for a move from an addnew or edit record
  309.   If Action < 5 Then
  310.     If save = True Then      'data changed
  311.       If data1.EditMode = EM_ADDNEW Then
  312.         If MsgBox("Save New Record?", MSGBOX_TYPE) = YES Then
  313.           data1.UpdateRecord
  314.           If Err <> 0 Then
  315.             MsgBox Error$, 0, "Data Manager"
  316.             Action = 0: save = 0
  317.           End If
  318.           save = 0
  319.         Else
  320.             save = 0
  321.         End If
  322.       ElseIf MsgBox("Commit Changes?", MSGBOX_TYPE) <> YES Then
  323.          save = False        'loose changes
  324.       End If
  325.     End If
  326.   data1.Caption = "Editing Record"
  327.   End If
  328.  
  329.   Select Case Action
  330.     Case 1          'First
  331.     Case 6          'Update
  332.       If save = True Then
  333.         If data1.EditMode = EM_ADDNEW Then
  334.           If MsgBox("Save New Record?", MSGBOX_TYPE) = YES Then
  335.             data1.UpdateRecord
  336.             data1.Caption = "Editing Record"
  337.           Else
  338.             save = 0: Action = 0
  339.           End If
  340.         ElseIf MsgBox("Commit Changes?", MSGBOX_TYPE) = YES Then
  341.           data1.UpdateRecord
  342.         End If
  343.       End If
  344.  
  345.     Case 10          'Close
  346.       If save = True Then
  347.         If MsgBox("Commit Changes before Closing?", MSGBOX_TYPE) = YES Then
  348.         Else
  349.           Cancel = True
  350.         End If
  351.       End If
  352.  
  353.   End Select
  354.  
  355.  
  356. End Sub
  357.  
  358. Sub DeleteBtn_Click ()
  359.   On Error GoTo DelErr
  360.  
  361.   If MsgBox("Delete Current Record?", MSGBOX_TYPE) = YES Then
  362.     data1.Recordset.Delete
  363.     data1.Recordset.MoveNext
  364.     If AddBtn.Tag <> "Disabled" Then FldArr(0).SetFocus
  365.   End If
  366.  
  367.   GoTo DelEnd
  368.  
  369. DelErr:
  370.     If Err = 444 Then
  371.         MsgBox "Can't delete this record.", 64, "Data Manager"
  372.     ElseIf Err = 3021 Then
  373.         DisableAllControls
  374.     Else
  375.         MsgBox Error$, 64, "Data Manager"
  376.     End If
  377.     If AddBtn.Tag <> "Disabled" Then FldArr(0).SetFocus
  378.   Resume DelEnd
  379.  
  380. DelEnd:
  381.  
  382. End Sub
  383.  
  384. Sub DisableAllControls ()
  385.  
  386.     On Error GoTo disableerror
  387.     'This handles the case of calls with empty tables before
  388.     'call of loadfields.  Otherwise, you get subscript out of range.
  389.    
  390.    Dim i As Integer
  391.    DeleteBtn.Enabled = False
  392.    UpdateBtn.Enabled = False
  393. '   FindBtn.Enabled = False
  394.    For i = 0 To data1.Recordset.Fields.Count - 1
  395.      FldArr(i).Visible = False
  396.    Next i
  397.  
  398.     GoTo disableend
  399. disableerror:
  400.     Resume disableend
  401. disableend:
  402.    AddBtn.Tag = "Disabled"
  403.    data1.Caption = "No Current Record"
  404.  
  405. End Sub
  406.  
  407. Sub EnableAllControls ()
  408.    
  409.    Dim i As Integer
  410.    DeleteBtn.Enabled = True
  411.    UpdateBtn.Enabled = True
  412. '   FindBtn.Enabled = True
  413.  
  414.    For i = 0 To data1.Recordset.Fields.Count - 1
  415.      FldArr(i).Visible = True
  416.    Next i
  417.    AddBtn.Tag = "Enabled"
  418.    If data1.Caption <> "Entering New Record" Then
  419.     data1.Caption = "Editing Record"
  420.    End If
  421. End Sub
  422.  
  423. Sub FindBtn_Click ()
  424.   On Error GoTo FindErr
  425.   Dim bm As String, findstr As String
  426.  
  427.   findstr = InputBox("Enter Search Expression:")
  428.   If findstr = "" Then Exit Sub
  429.  
  430.   If Not data1.Recordset.BOF And Not data1.Recordset.EOF Then
  431.     bm = data1.Recordset.Bookmark
  432.   End If
  433.  
  434.   data1.Recordset.FindFirst findstr
  435.  
  436.   'return to old record if no match was found
  437.   If data1.Recordset.NoMatch And bm <> "" Then
  438.     data1.Recordset.Bookmark = bm
  439.   End If
  440.  
  441.   GoTo FindEnd
  442.  
  443. FindErr:
  444.   MsgBox Error$
  445.   Resume FindEnd
  446.  
  447. FindEnd:
  448.   If FldArr(0).Visible = True Then FldArr(0).SetFocus
  449.  
  450. End Sub
  451.  
  452. Sub Form_Load ()
  453.   Dim ds2 As Dynaset
  454.  
  455.   On Error GoTo LoadErr
  456.  
  457.   '-------------------------------------------------------
  458.   'this is where the data control properties get
  459.   'set from whatever source they are coming from
  460.   'in this case, it is mainform controls
  461.   '-------------------------------------------------------
  462.   Screen.MousePointer = 11 'wait cursor
  463.   data1.DatabaseName = gDatabaseName
  464.   data1.Connect = gDatabase.Connect
  465.   Me.Caption = UCase(gDatabaseName) + " : " + UCase(mainForm.TableName)
  466.   data1.RecordSource = mainForm.TableName
  467.   '-------------------------------------------------------
  468.   data1.Refresh
  469.  
  470.   LoadFields data1.Recordset, mainForm.TableName
  471.   data1_Reposition 'This ensures that we enable the controls
  472.   Me.Show
  473.   If AddBtn.Tag = "Enabled" Then
  474.     FldArr(0).SetFocus
  475.   End If
  476.   GoTo loadend
  477. LoadErr:
  478.  
  479.   MsgBox Error$
  480.   Unload Me
  481.   Resume loadend
  482.  
  483. loadend:
  484.   Screen.MousePointer = 0
  485. End Sub
  486.  
  487. Sub Form_Resize ()
  488.   On Error Resume Next
  489.  
  490.   If fResizing = True Then Exit Sub
  491.  
  492.   Dim h As Integer, i As Integer
  493.   Dim totw As Integer
  494.  
  495.   fResizing = True
  496.   If WindowState <> 1 And cFieldName(0).Visible = True Then 'not minimized
  497.     'make sure the form is lined up on a field
  498.     h = Height
  499.     If (h - 1340) Mod 350 <> 0 Then
  500.       Height = ((h - 1340) \ 350) * 350 + 1340
  501.     End If
  502.     'reset scroll
  503.     If Height - 1340 >= cFields.Height - 1065 + 350 Then
  504.         cScrollBar.Visible = False
  505.     Else
  506.         cScrollBar.Max = cScrollBar.Min + 350 * ((Height - 1340) \ 350) - (cFields.Height - 1065 + 350)
  507.         cScrollBar.Visible = True
  508.     End If
  509.     'resize the status bar
  510.     StatBox.Top = Height - 650
  511.     'resize the scrollbar
  512.     cScrollBar.Height = StatBox.Top - (FieldHeader.Top - FieldHeader.Height) - 600
  513.     cScrollBar.Left = Width - 360
  514.     If FDS.Fields.Count > 10 Then
  515.       cFields.Width = Width - 260
  516.       totw = cScrollBar.Left - 20
  517.     Else
  518.       cFields.Width = Width - 20
  519.       totw = Width - 50
  520.     End If
  521.     FieldHeader.Width = Width - 20
  522.     'widen the fields if possible
  523. '    data1.Database.TableDefs(TableName).Fields.Refresh
  524. '    For i = 0 To data1.Recordset.Fields.Count - 1
  525. '      cFieldName(i).Width = .3 * totw
  526. '       FldArr(i).Left = cFieldName(i).Width + 20
  527. '      If data1.Recordset.Fields(i).Type > 9 Then
  528. '        FldArr(i).Width = .7 * totw - 270
  529. '      End If
  530. '    Next
  531.     FieldValueLabel.Left = FldArr(0).Left
  532.   End If
  533.  
  534.   data1.Width = StatBox.Width
  535.   fResizing = False
  536.  
  537. End Sub
  538.  
  539. Function GetFieldWidth (t As Integer)
  540.   'determines the form control width
  541.   'based on the field type
  542.   Select Case t
  543.     Case FT_TRUEFALSE
  544.       GetFieldWidth = 850
  545.     Case FT_BYTE
  546.       GetFieldWidth = 650
  547.     Case FT_INTEGER
  548.       GetFieldWidth = 900
  549.     Case FT_LONG
  550.       GetFieldWidth = 1100
  551.     Case FT_CURRENCY
  552.       GetFieldWidth = 1800
  553.     Case FT_SINGLE
  554.       GetFieldWidth = 1800
  555.     Case FT_DOUBLE
  556.       GetFieldWidth = 2200
  557.     Case FT_DATETIME
  558.       GetFieldWidth = 2000
  559.     Case FT_STRING
  560.       GetFieldWidth = 3250
  561.     Case FT_MEMO
  562.       GetFieldWidth = 3250
  563.     Case Else
  564.       GetFieldWidth = 3250
  565.   End Select
  566.  
  567. End Function
  568.  
  569. Sub LoadFields (t As Dynaset, tName)
  570.    
  571. '   Dim t As table
  572.    Dim ft As Integer
  573.    Dim i As Integer
  574.  
  575.    On Error GoTo LoadFieldsErr
  576.  
  577. '   Set t = db.OpenTable(tName)
  578.  
  579.    'load the controls on the dynaset form
  580.    numFlds = t.Fields.Count
  581.  
  582.     If numFlds = 0 Then
  583.         MsgBox "There are no fields in this table.  Cannot Edit Table Data", 64, "Data Manager"
  584.         Unload Me
  585.     End If
  586.  
  587.    ReDim FldArr(numFlds) As control
  588.    cFieldName(0).Visible = True
  589.    ft = t.Fields(0).Type
  590.    If ft = FT_TRUEFALSE Then
  591.      Set FldArr(0) = cFieldCheck(0)
  592.    ElseIf ft = FT_BINARY Then
  593.      Set FldArr(0) = cFieldPicture(0)
  594.    Else
  595.      Set FldArr(0) = cFieldData(0)
  596.    End If
  597.    FldArr(0).Visible = True
  598.    FldArr(0).Top = 0
  599.    FldArr(0).Width = GetFieldWidth(ft)
  600.    FldArr(0).TabIndex = 0
  601.  
  602.    On Error Resume Next
  603.    For i = 1 To t.Fields.Count - 1
  604.      cFields.Height = cFields.Height + 350
  605.      Load cFieldName(i)
  606.      cFieldName(i).Top = cFieldName(i - 1).Top + 350
  607.      cFieldName(i).Visible = True
  608.      ft = t.Fields(i).Type
  609.      If ft = FT_TRUEFALSE Then
  610.        Load cFieldCheck(i)
  611.        Set FldArr(i) = cFieldCheck(i)
  612.      ElseIf ft = FT_BINARY Then
  613.        Load cFieldPicture(i)
  614.        Set FldArr(i) = cFieldPicture(i)
  615.      Else
  616.        Load cFieldData(i)
  617.        Set FldArr(i) = cFieldData(i)
  618.      End If
  619.      FldArr(i).Top = FldArr(i - 1).Top + 350
  620.      FldArr(i).Width = GetFieldWidth(ft)
  621.      FldArr(i).TabIndex = i
  622.    Next
  623.    AddBtn.Tag = "Disabled"
  624.  
  625.    On Error GoTo LoadFieldsErr
  626.  
  627.    'resize main window
  628.    cFields.Top = FieldHeader.Top + FieldHeader.Height
  629.    FldTop = cFields.Top
  630.    cScrollBar.Min = FldTop
  631.    If i <= 10 Then
  632.      Height = i * 350 + 1500
  633.      cScrollBar.Visible = False
  634.    Else
  635.      Height = 5000
  636.      Width = Width + 260
  637.      cScrollBar.Visible = True
  638.      cScrollBar.Max = FldTop - (i * 350) + 3500
  639.      cScrollBar = FldTop
  640.    End If
  641.  
  642.    'display the field names
  643.    For i = 0 To t.Fields.Count - 1
  644.      cFieldName(i) = UCase(t.Fields(i).Name) + ":"
  645.    Next
  646.    
  647.    'bind the controls
  648.    On Error Resume Next   'bind even if table is empty
  649.    For i = 0 To t.Fields.Count - 1
  650.      FldArr(i).DataField = t.Fields(i).Name
  651.    Next
  652.  
  653.    GoTo LoadFieldsEnd
  654.  
  655. LoadFieldsErr:
  656.    MsgBox Error$
  657.    Resume LoadFieldsEnd
  658.  
  659. LoadFieldsEnd:
  660.  
  661. End Sub
  662.  
  663. Sub MoveBtn_Click (Index As Integer)
  664.   On Error GoTo moveerr
  665.   Dim bm As String
  666.  
  667.   If Not data1.Recordset.BOF And Not data1.Recordset.EOF Then
  668.     bm = data1.Recordset.Bookmark
  669.   End If
  670.   Select Case Index
  671.     Case 0
  672.       If findval <> "" Then
  673.         data1.Recordset.FindFirst findval
  674.       Else
  675.         data1.Recordset.MoveFirst
  676.       End If
  677.     Case 1
  678.       If findval <> "" Then
  679.         data1.Recordset.FindPrevious findval
  680.       Else
  681.         data1.Recordset.MovePrevious
  682.       End If
  683.     Case 2
  684.       If findval <> "" Then
  685.         data1.Recordset.FindNext findval
  686.       Else
  687.         data1.Recordset.MoveNext
  688.       End If
  689.     Case 3
  690.       If findval <> "" Then
  691.         data1.Recordset.FindLast findval
  692.       Else
  693.         data1.Recordset.MoveLast
  694.       End If
  695.   End Select
  696.   'return to old record if no match was found
  697.   If data1.Recordset.NoMatch And bm <> "" Then
  698.     data1.Recordset.Bookmark = bm
  699.   End If
  700.  
  701.   GoTo moveend
  702.  
  703. moveerr:
  704.   MsgBox Error$
  705.   Resume moveend
  706.  
  707. moveend:
  708.   FldArr(0).SetFocus
  709. End Sub
  710.  
  711. Sub RefreshBtn_Click ()
  712.   data1.Refresh
  713. End Sub
  714.  
  715. Sub UpdateBtn_Click ()
  716.   On Error GoTo UpdErr
  717.  
  718.   data1.Recordset.Update
  719.  
  720.   GoTo UpdEnd
  721. UpdErr:
  722.   MsgBox Error$
  723.   Resume UpdEnd
  724.  
  725. UpdEnd:
  726.  
  727. End Sub
  728.  
  729.